home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
clang
/
ndp.zip
/
TEST_NDP.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-07-31
|
4KB
|
97 lines
page 60,132
title TEST_NDP.COM Math Coprocessor Check
; TEST_NDP - Check for Math Coprocessor -
; Report Presence and Type....
;
; FREELY adopted from Ted Forgeron's
; article and code in PC Tech
; Journal, Aug 87 p 43 /Psi!
;
code segment public
assume cs:code,ds:code ; Set it up as
org 100h ; a .COM file.
; Don't forget to EXEBIN !!
start: jmp begin
control dw 0
checkin db 10
db 'Checking for a Math Coprocessor....',10,10,13
db 'I see $'
gotnone db 'NO CHIP $'
gota_87 db 'an 8087 $'
gota287 db 'an 80287 $'
gota387 db 'an 80387 $'
goodbye db 'in here !!',10,10,'$'
begin: mov DX,offset checkin ; say hello
call tellem
; Check for an NDP. Don't forget to assemble with the /R option
; set in MASM or you'll bomb cuz of the coprocessor instructions.
do_we: mov DX,offset gotnone ; load Ur message
fninit ; try to initialize NDP
mov byte ptr control+1,0 ; clear memory byte
fnstcw control ; put control word in mem
mov AH,byte ptr control+1 ; iff AH is 03h, you got
cmp AH,03h ; an NDP on board !!
je chk_87 ; found somethin', keep goin'
call tellem
call saybye
; 'got an 8087 ??
chk_87: mov DX,offset gota_87 ; load next message
and control,NOT 0080h ; turn ON interrupts (IEM=0)
fldcw control ; load control word
fdisi ; turn OFF interrupts (IEM=1)
fstcw control ; store control word
test control,0080h ; iff IEM=1, 8087
jz chk287 ; 'guess not! March on....
call tellem ; tell 'em and bail out
call saybye
; if not.... would you believe an 80287 maybe ??
chk287: mov DX,offset gota287 ; load up Ur '287 message
finit ; set default infinity mode
fld1 ; make infinity
fldz ; by dividing
fdiv ; 1 by zero !!
fld st ; now make a
fchs ; negative infinity
fcompp ; compare Ur two infinities
fstsw control ; iff, for 8087 or 80287
fwait ; 'til status word is put away
mov AX,control ; getchur control word
sahf ; putchur AH into flags
jnz got387 ; NO GOOD.... march on !!
call tellem ; gotta be a 80287 cuz we al-
call saybye ; ready tested for an 8087
; We KNOW that there is an NDP on board otherwise we would have bailed
; out after 'do_we'. It isn't an 8087 or an 80287 or we wouldn't have
; gotten this far. It's gotta be an 80387 !!
got387: mov DX,offset gota387 ; it isn't an 8087 or an 80287
call tellem ; but we do know it is an NDP
call saybye
tellem proc
mov AH,09h ; spread the word
int 21h
ret
tellem endp
saybye proc
mov DX,offset goodbye
call tellem
mov AX,4c00h ; bail out !!
int 21h
saybye endp
code ends
end start